<?php
/* @var $this ProfileController 
 * @var $data Resident
 * */
if(!Yii::app()->user->isGuest && isset(Yii::app()->user->userModel)){
	$matric_no = $data->matric_no;
	$user_model = $data;
	$cca_count = sizeof($user_model->ccaResidents);
}
$this->breadcrumbs=array(
	'Profile',
);
?>
<?php if(!Yii::app()->user->isGuest){?>
	<?php if(isset($cca_count)){?>
		<h3>You are involved in <?=$cca_count?> activities:</h3>
		<?php 
		foreach($user_model->ccaResidents as $ccaResident){
		?>
		<p>
			<h3><?php echo $ccaResident->cca->name; ?></h3>
			Role: <?=$ccaResident->role->name; ?><br/>
			Points: <?=$ccaResident->point; ?>
		</p>
		<?php }?>
	<?php }?>
<?php }?>

<h3>Your personal details:</h3>

	<b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?>:</b>
	<?php echo CHtml::encode($data->name); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('matric_no')); ?>:</b>
	<?php echo CHtml::encode($data->matric_no); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('gender')); ?>:</b>
	<?php echo CHtml::encode($data->gender); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('classification')); ?>:</b>
	<?php echo CHtml::encode($data->classification); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('nationality')); ?>:</b>
	<?php echo CHtml::encode($data->nationality); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('room')); ?>:</b>
	<?php echo CHtml::encode($data->room); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('email_school')); ?>:</b>
	<?php echo CHtml::encode($data->email_school); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('email')); ?>:</b>
	<?php echo CHtml::encode($data->email); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('phone')); ?>:</b>
	<?php echo CHtml::encode($data->phone); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('faculty')); ?>:</b>
	<?php echo CHtml::encode($data->faculty); ?>
	<br />

	<b><?php echo CHtml::encode($data->getAttributeLabel('active')); ?>:</b>
	<?php echo CHtml::encode($data->active); ?>
	<br /><br/>
	<?php echo CHtml::link(CHtml::encode('Edit your information'), array('edit')); ?>

